/*
	created time:2018/4/4
	author:Chason
	describe:人物动画--男生
*/
class Boy extends egret.Sprite {
	private constructor() {
		super();
		this.init();

	}

	private  stageWidth=egret.MainContext.instance.stage.stageWidth;
	private  stageHeight=egret.MainContext.instance.stage.stageHeight;
	
	//初始化
	public init(): void {
		//人物骨骼动画
		let dragonbonesData = RES.getRes("Boy_ske_json");
		let textureData = RES.getRes("Boy_tex_json");
		let texture = RES.getRes("Boy_tex_png");
		let egretFactory: dragonBones.EgretFactory = dragonBones.EgretFactory.factory;
		egretFactory.parseDragonBonesData(dragonbonesData);
		egretFactory.parseTextureAtlasData(textureData, texture);
		let armatureDisplay: dragonBones.EgretArmatureDisplay = egretFactory.buildArmatureDisplay('armatureName');
		this.addChild(armatureDisplay);
		armatureDisplay.animation.play('newAnimation', 0);
		this.scaleX=0.9;
		this.scaleY=0.9;
		armatureDisplay.x=this.stageWidth/2+50;
		armatureDisplay.y=this.stageHeight-200;
		//脚底光圈动画
		let footerTexture:egret.Texture = RES.getRes( "home_json.footerLight" );
		let footerImg:egret.Bitmap = new egret.Bitmap(footerTexture);
		this.addChild(footerImg);
		footerImg.x=this.stageWidth/2-70;
		footerImg.y=this.stageHeight-180;
		footerImg.scaleX=0.9;
		footerImg.scaleY=0.9;
		         

		
	}


	//单例模式
	public static boy: Boy;
	public static getInstance(): Boy {		
		if(!this.boy){
			this.boy=new Boy();
		}	
		return this.boy;
	}

}